import { createAppContainer, createSwitchNavigator } from 'react-navigation';
import { createStackNavigator } from 'react-navigation-stack';
import WelcomePage from '../page/WelcomePage';
import HomePage from '../page/HomePage';
import FetchDemoPage from '../page/FetchDemoPage';
import AsyncStoragePage from '../page/AsyncStoragePage';
import DataStoreDemoPage from '../page/DataStoreDemoPage';
import DetailPage from '../page/DetailPage';
import WebViewPage from '../page/WebViewPage';
import AboutPage from '../page/about/AboutPage';
import AboutMePage from '../page/about/AboutMePage';
import CustomKeyPage from '../page/CustomKeyPage';
import SortKeyPage from '../page/SortKeyPage';
import SearchPage from '../page/SearchPage';

// 欢迎页的导航器
const InitNavigator = createStackNavigator(
    {
        WelcomePage: {
            screen: WelcomePage,
            navigationOptions: {
                headerShown: false // 隐藏头部，低版本为 header:null
            }
        }
    }
)

// 主页的导航器
const MainNavigator = createStackNavigator(
    {
        HomePage: {
            screen: HomePage,
            navigationOptions: {
                headerShown: false // 隐藏头部，低版本为 header:null
            }
        },
        FetchDemoPage: {
            screen: FetchDemoPage,
            navigationOptions: {
                headerShown: false // 隐藏头部，低版本为 header:null
            }
        },
        AsyncStoragePage: {
            screen: AsyncStoragePage,
            navigationOptions: {
                headerShown: false // 隐藏头部，低版本为 header:null
            }
        },
        DataStoreDemoPage: {
            screen: DataStoreDemoPage,
            navigationOptions: {
                headerShown: false // 隐藏头部，低版本为 header:null
            }
        },
        DetailPage: {
            screen: DetailPage,
            navigationOptions: {
                headerShown: false // 隐藏头部，低版本为 header:null
            }
        },
        WebViewPage: {
            screen: WebViewPage,
            navigationOptions: {
                headerShown: false // 隐藏头部，低版本为 header:null
            }
        },
        AboutPage: {
            screen: AboutPage,
            navigationOptions: {
                headerShown: false // 隐藏头部，低版本为 header:null
            }
        },
        AboutMePage: {
            screen: AboutMePage,
            navigationOptions: {
                headerShown: false // 隐藏头部，低版本为 header:null
            }
        },
        CustomKeyPage: {
            screen: CustomKeyPage,
            navigationOptions: {
                headerShown: false // 隐藏头部，低版本为 header:null
            }
        },
        SortKeyPage: {
            screen: SortKeyPage,
            navigationOptions: {
                headerShown: false // 隐藏头部，低版本为 header:null
            }
        },
        SearchPage: {
            screen: SearchPage,
            navigationOptions: {
                headerShown: false // 隐藏头部，低版本为 header:null
            }
        },
    })

// 整个App的导航器
export default createAppContainer(
    createSwitchNavigator(
        {
            Init: InitNavigator,
            Main: MainNavigator
        }
    ),
    {
        navigationOptions: {
            headerShown: false // 隐藏头部，低版本为 header:null
        }
    }
)